<template>
    <div>
        <Menu mode="horizontal" theme="dark" active-name="1">
            <div class="layout-logo">
                <div style="width:200px;">
                    <!-- <img src="../../assets/image/logosjld.png" id="web_favicon" class="img_style"> -->
                    <img :src="logosjld" id="web_favicon" class="img_style">
                </div>
            </div>
            <div class="layout-nav">
            </div> 
            <div style="float:right">
                <Button  @click="logout()">退出</Button>
            </div>
        </Menu>
    </div>

</template>
<style scoped>
.layout-logo{
    /* width: 100px;
    height: 30px;
    background: #5b6270;
    border-radius: 3px; */
    float: left;
    position: relative;
    top: 10px;
    left: 10px;
}
.layout-nav{
    width: 420px;
    margin: 0 auto;
    margin-right: 20px;
}
</style>
<script>
// 引入axios组件
import axios from "axios";
import qs from "qs"; //处理数据  qs.stringify(params)

export default {
  name:"appHeader",
  data(){
      return {
          title:"我是头部",
          logosjld:'',
      }
  },
  created(){
    const self = this;
    axios({
    method: "post",
    url: "/admin/website/getLogo",
    data: {}
    })
    .then(function (response) {
        console.log(response);
        self.logosjld = response.data.logo;
    })
    .catch(function (response) {
        
    });
  },
  methods:{
      logout(){
        const self = this;
        axios({
        method: "post",
        url: "/admin/login/layout",
        data: {}
        })
        .then(function (response) {
            localStorage.clear();
            let status = false;
            self.$store.commit("putloginstatus", status);
            if(response.data.code == 1){
                self.$Message.success(response.data.msg);
                self.$router.push({
                    path:'/login',
                });
            }else{
                self.$Message.error(response.data.msg);
            }
        })
        .catch(function (response) {
            self.$Message.error('请求失败');
        });

        /*localStorage.clear();
        let status = false;
        this.$store.commit("putloginstatus", status);  
        if(localStorage.userinfo == undefined){
        this.$Message.success('退出成功');
        }else{
        this.$Message.error('退出失败');
        }
        this.$router.push({
            path:'/login',
        });//*/
      }
  }
}
</script>
